package com.engine.salary.sys.enums;

import com.engine.salary.enums.BaseEnum;
import org.apache.commons.lang3.StringUtils;

/**
 * 人员匹配规则枚举
 * @author songyang
 **/
public enum MatchEmployeeModeEnum implements BaseEnum<String> {

    //"0"代表按照姓名+部门+手机号为条件的人员匹配方式，"1"代表按照工号为条件的人员匹配方式
    NAMEDEPMOBILEMATCH("0", "姓名-部门-手机号", 1),
    WORKCODEMATCH("1", "工号", 1),
    IDNO("2", "证件号码", 1);

    private String value;

    private String defaultLabel;

    private int labelId;


    MatchEmployeeModeEnum(String value, String defaultLabel, int labelId) {
        this.value = value;
        this.defaultLabel = defaultLabel;
        this.labelId = labelId;
    }

    @Override
    public String getValue() {
        return value;
    }

    @Override
    public String getDefaultLabel() {
        return defaultLabel;
    }

    @Override
    public Integer getLabelId() {
        return labelId;
    }

    public static MatchEmployeeModeEnum parseByValue(String value) {
        for (MatchEmployeeModeEnum matchEmployeeModeEnum : MatchEmployeeModeEnum.values()) {
            if (StringUtils.equals(matchEmployeeModeEnum.getValue(), value)) {
                return matchEmployeeModeEnum;
            }
        }
        return NAMEDEPMOBILEMATCH;
    }
}
